using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Practices.ObjectBuilder;
using Microsoft.Practices.CompositeWeb;
using System.Transactions;
using GC2.Entities.Admin;
using GC2.ExceptionHandler.Services;
using GC2.DataAccess.DAAdmin;

namespace GC2.Bussines.BMAdmin
{
    public class BMIngresos
    {
        public BMIngresos(string coneccion) 
        {
            this.Connection = coneccion;
        }

        private string connection = "";
        public string Connection
        {
            get { return connection; }
            set { connection = value; }
        }

        private Ingresos oIngresos = new Ingresos();
        private List<Ingresos> listaIngresos = new List<Ingresos>();
        private DAIngresos daIngresos = new DAIngresos();

        #region BMIngresosSearch
        public List<Ingresos> BMIngresosSearch(Ingresos ingresoD, Ingresos ingresoH)
        {
            try
            {
                listaIngresos = daIngresos.DAIngresosSearch(connection, ingresoD, ingresoH);
                return listaIngresos;
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region BMIngresosInsert
        public void BMIngresosInsert(Ingresos ingreso)
        {
            try
            {
                daIngresos.DAIngresosInsert(connection, ingreso);
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region BMIngresosUpdate
        public void BMIngresosUpdate(Ingresos ingreso)
        {
            try
            {
                daIngresos.DAIngresosUpdate(connection, ingreso);
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region BMIngresosGetNext
        public Ingresos BMIngresosGetNext()
        {
            try
            {
                oIngresos = daIngresos.DAIngresosGetNext(connection);
                return oIngresos;
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region BMIngresosDelete
        public void BMIngresosDelete(Ingresos ingreso)
        {
            try
            {
                daIngresos.DAIngresosDelete(connection, ingreso);
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

    }
}